package com.zdxc.controller;

import common.util.UserInfoUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value="/home")
public class IndexController {



    @RequestMapping(value="/main")
    public ModelAndView main()
    {
        ModelAndView mv = new ModelAndView();
        if (UserInfoUtils.getUser()==null)
            mv.setViewName("login");
        else{
            mv.setViewName("index");
            mv.addObject("realName",UserInfoUtils.getUser().getUserName());
        }

        return mv;
    }

    @RequestMapping(value="/login")
    public ModelAndView login(ModelAndView modelAndView) {
        modelAndView.setViewName("login");
        return modelAndView;
    }



}